package com.sms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sms.mapper.PromotionsMapper;
import com.sms.pojo.Promotions;
import com.sms.service.PromotionsService;
import com.sms.util.SqlSessionFactoryUtil;
import lombok.Getter;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

@Getter
public class PromotionsServiceImpl extends ServiceImpl<PromotionsMapper, Promotions> implements PromotionsService {

    SqlSession sqlSession=null;

    @Override
    public PromotionsMapper getBaseMapper() {
        SqlSessionFactory factory = SqlSessionFactoryUtil.getFactory();
        sqlSession=factory.openSession(true);
        PromotionsMapper mapper = factory.getConfiguration().getMapper(PromotionsMapper.class, sqlSession);
        return mapper;
    }


    @Override
    public List<Promotions> listPromotions() {
        return this.getBaseMapper().listPromotions();
    }
}
